package top.cardone.security.shiro.func;

import lombok.Setter;
import top.cardone.context.ApplicationContextHolder;
import top.cardone.core.util.func.Func1;
import top.cardone.security.Descipher;

/**
 * Created by Administrator on 2016/7/22.
 */
public class ReadCredentialsForAesFunc implements Func1<Object, Object> {
	@Setter
	private String key = "top.";

	@Setter
	private String descipherBeanName = Descipher.class.getName();

	@Override
	public Object func(Object principal) {
		return ApplicationContextHolder.getBean(Descipher.class, descipherBeanName).encrypt(key, (String) principal);
	}
}